<?php if (!defined('THINK_PATH')) exit();?><div class="bjui-pageHeader">
    <div class="pull-right">
        <button class="btn-default" data-icon="refresh" onclick="$.CurrentNavtab.navtab('refresh')"></button>
    </div>
</div>
<div class="bjui-pageContent">
    <form action="<?php echo U('save_distr');?>" data-toggle="validate" data-alertmsg="false" class="navtabForm">
        <div class="form-group">
            <label class="x100">分销开关:</label>
            <input type="radio" name="distr_status" value="0" id="distr-status1" data-toggle="icheck" data-label="开启" <?php if($va["distr_status"] != '1'): ?>checked<?php endif; ?>  />
            <input type="radio" name="distr_status" value="1" id="distr-status2" data-toggle="icheck" data-label="关闭"  <?php if($va["distr_status"] == '1'): ?>checked<?php endif; ?> />
        </div>
        <div class="form-group">
            <label class="x100">成为分销商:</label>
            <input type="radio" name="distr_factor" value="1" id="distr-factor1" data-toggle="icheck" data-label="直接成为分销商"  <?php if($va["distr_factor"] == '1' or $va["distr_factor"] == null): ?>checked<?php endif; ?>  />
            <input type="radio" name="distr_factor" value="2" id="distr-factor2" data-toggle="icheck" data-label="成功购买商品后"  <?php if($va["distr_factor"] == '2'): ?>checked<?php endif; ?> />
            <input type="radio" name="distr_factor" value="3" id="distr-factor3" data-toggle="icheck" data-label="手动添加"   <?php if($va["distr_factor"] == '3'): ?>checked<?php endif; ?>/>
        </div>
        <div class="form-group">
            <label class="x100">分销名称:</label>
            <input type="text" name="distr_name" value="<?php echo ($va["distr_name"]); ?>" data-rule="required" />
        </div>
        <div class="form-group">
            <label class="x100">分销模式:</label>
            <select name="distr_type" class="order-type" data-toggle="selectpicker">
                <option value="1" <?php if($va["distr_type"] != '2'): ?>selected<?php endif; ?>>按订单设置分成</option>
                <option value="2" <?php if($va["distr_type"] == '2'): ?>selected<?php endif; ?>>按商品设置分成</option>
            </select>
        </div>
        <div class="form-group order-bili" <?php if($va["distr_type"] == '2'): ?>style="display:none"<?php endif; ?>>
            <label class="x100">订单分成比例:</label>
            <input type="text" name="distr_order_sale"  class="w60" value="<?php echo ($va["distr_order_sale"]); ?>"/> %
            <span class="text-warning">订单总额百分比拿来分成</span>
        </div>
        <div class="form-group">
            <label class="x100">一级分销商名称:</label>
            <input type="text" name="distr_one_name" data-rule="required" value="<?php echo ($va["distr_one_name"]); ?>"/>
        </div>
        <div class="form-group">
            <label class="x100">一级分销比例:</label>
            <input type="text" name="distr_one_sale" data-rule="required;digits" class="w60" value="<?php echo ($va["distr_one_sale"]); ?>"/> %
        </div>
        <div class="form-group">
            <label class="x100">二级分销商名称:</label>
            <input type="text" name="distr_two_name" value="<?php echo ($va["distr_two_name"]); ?>"/>
        </div>
        <div class="form-group">
            <label class="x100">二级分销比例:</label>
            <input type="text" name="distr_two_sale" value="<?php echo ($va["distr_two_sale"]); ?>" class="w60" /> %
        </div>
        <div class="form-group">
            <label class="x100">三级分销商名称:</label>
            <input type="text" name="distr_three_name" value="<?php echo ($va["distr_three_name"]); ?>" />
        </div>
        <div class="form-group">
            <label class="x100">三级分销比例:</label>
            <input type="text" name="distr_three_sale" value="<?php echo ($va["distr_three_sale"]); ?>" class="w60" /> %
        </div>
        <div class="form-group">
            <label class="x100">分成时间:</label>
           <!--  <input type="radio" name="distr_factor" value="1" id="distr-factor1" data-toggle="icheck" data-label="付完款后就分成"  checked  />
            <input type="radio" name="distr_factor" value="2" id="distr-factor2" data-toggle="icheck" data-label="收货后分成"   /> -->
            <input type="text" name="distr_time" data-rule="required;digits" class="w60" value="<?php echo ($va["distr_time"]); ?>"/> 天
            <span class="text-warning">订单收货后多少天可以分成</span> 
        </div>
         <div class="form-group">
             <label class="x100">满多少才能提现:</label>
             <input type="text" name="max_money" data-rule="required;digits" value="<?php echo ($va["max_money"]); ?>"class="w100" /> 元
         </div>
        <div class="form-group">
            <label class="x100">最少提现额度:</label>
            <input type="text" name="nim_money" data-rule="required;digits" value="<?php echo ($va["nim_money"]); ?>" class="w100" /> 元
        </div>
    </form>
</div>
<script>
    $(function () {
        $('.order-type').change(function (e) {
            if ( $(this).val() == 1 ) {
                $('.order-bili').show();
            }else {
                $('.order-bili').hide();
            }
        });
    });
</script>

<div class="bjui-pageFooter">
		
	<?php if(save == save): ?><ul>
			<li><button type="submit" class="btn-default" data-icon="save">保存</button></li>
	        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
	    </ul>
	<?php elseif(save == close): ?>
	    <ul>
	        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
	    </ul>
	<?php elseif(save == page and $show != null): ?>
		<ul>
	        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
	    </ul>
		    <div class="pages">
		        <span>每页&nbsp;</span>
		        <div class="selectPagesize">
		            <select data-toggle="selectpicker" data-toggle-change="changepagesize">
		                <option value="<?php echo ($show['listrow']); ?>"><?php echo ($show['listrow']); ?></option>
		                <option value="60">60</option>
		                <option value="120">120</option>
		                <option value="150">150</option>
		            </select>
		        </div>
		        <span>&nbsp;条，共 <?php echo ($show['total']); ?> 条</span>
		    </div>
		    <div class="pagination-box" data-toggle="pagination" data-total="<?php echo ($show['total']); ?>" data-page-size="<?php echo ($show['listrow']); ?>" data-page-current="1">
		    </div>
	<?php elseif(save == page and $show == null): ?>
		<ul>
			<li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
		</ul>
	<?php else: ?>
		<ul>
			<li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
		</ul><?php endif; ?>

</div>